﻿
using Test30.Engine;

namespace Test30.Data
{
    public static class DataFiles
    {

        public static Content Load()
        {
            if (_content == null)
            {
                _content = new Content();
                Items.Load(@"..\..\..\..\Assets\Resources\Text\Items.txt", _content);
                Powers.Load(@"..\..\..\..\Assets\Resources\Text\Prefix Powers.txt", _content, true);
                Powers.Load(@"..\..\..\..\Assets\Resources\Text\Suffix Powers.txt", _content, false);

                DropMacroCollection<Item> dropMacros = Macros.LoadItemDrops(@"..\..\..\..\Assets\Resources\Text\Drops", _content);
                Races.Load(@"..\..\..\..\Assets\Resources\Text\Monsters.txt", dropMacros, _content);

                Features.Load(@"..\..\..\..\Assets\Resources\Text\Dungeon\Rooms.txt", _content);
            }
            return _content;
        }

        public static Content FromUnityLoad(string path)
        {
            if (_content == null)
            {
                _content = new Content();
                Items.Load($"{path}/Resources/Text/Items.txt", _content);
                Powers.Load($"{path}/Resources/Text/Prefix Powers.txt", _content, true);
                Powers.Load($"{path}/Resources/Text/Suffix Powers.txt", _content, false);

                DropMacroCollection<Item> dropMacros = Macros.LoadItemDrops($"{path}/Resources/Text/Drops", _content);
                Races.Load($"{path}/Resources/Text/Monsters.txt", dropMacros, _content);

                Features.Load($"{path}/Resources/Text/Dungeon/Rooms.txt", _content);
            }
            return _content;
        }

        private static Content _content;
    }
}
